package com.bupt.controller;

import com.bupt.config.CorrectionResult;
import com.bupt.service.TemperatureService;
import com.bupt.vo.ChannelCorrectionParamVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Api(value="分区温度信息接口",description="分区时间段温度数据、温度修正数据、指定通道插点")
@RestController
public class TemperatureController {

    @Autowired
    private TemperatureService temperatureService;

    @ApiOperation("分区时间段温度数据")
    @RequestMapping(value = "/AreaTheAgeTemperature",method = RequestMethod.GET)
    public Map AreaTheAgeTemperature(){
        return temperatureService.getAreaTheAgeTemperature();
    }



    @ApiOperation("温度修正数据")
    @GetMapping("/Temperature/correction/{deviceChannelId}")
    public List<ChannelCorrectionParamVo> correctionByDeviceChannelId(@PathVariable("deviceChannelId")Integer deviceChannelId) {
        return temperatureService.correctionByDeviceChannelId(deviceChannelId);

    }


    @ApiOperation("指定通道插点")
    @PostMapping("/Temperature/correctionAndInter/add/{deviceChannelId}")
    public CorrectionResult correctionAndInterAdd(@PathVariable("deviceChannelId")Integer deviceChannelId,@RequestParam("temperature") String temperature, @RequestParam("position") String position) {
        return temperatureService.correctionAndInterAdd(deviceChannelId,temperature, position);
    }


}
